home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 October: Technology Seed / ADC Seed CD - October 1999.toast / FireWire / FireWire_2.1_SDK_DR3 / Source / AVTransport / FWAVCDriver / FWAVCDriver.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-05-17  |  8.9 KB  |  240 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        FWAVCDriver.h
  3.  
  4.     Contains:    Definitions for FWAVCDriver.
  5.  
  6.     Written by:    Erik Staats
  7.  
  8.     Copyright:    © 1996-1997 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.  
  12.       <FW16>     3/10/97    ES        Added defs for maximum DCL size and NTSC frame rates.
  13.       <FW15>     3/10/97    ES        Changed to remove empty packets to resynchronize after lost
  14.                                     cycles. Changed to loop over one frame on playback instead of
  15.                                     three. Changed to play at a settable frame rate (29.97 Hz in
  16.                                     header) with settable buffer group sizes. Improved memory
  17.                                     allocation for playback.
  18.       <FW14>      3/3/97    ES        Added totalPlayPackets to FWAVCDriverData record and
  19.                                     pFrameDCLTimeStamp to FWAVCFrameData record.
  20.       <FW13>     1/16/97    ES        Added use of DCLUpdateList commands.
  21.       <FW12>      1/1/97    ES        Added defs to add UpdateDCLList command to record DCL program.
  22.       <FW11>     8/26/96    ES        Changed to new command object interface.
  23.       <FW10>     8/26/96    ES        Added localFWReferenceID to FWAVCDriverData record.
  24.        <FW9>     8/19/96    ES        Replaced fwIsochChannelRequestParams with
  25.                                     fwStopIsochChannelParams and fwStartIsochChennelParams in
  26.                                     FWAVCDriverData record.
  27.        <FW8>     8/16/96    ES        Added pFWAllocateIsochPortParams to FWAVCDriverData record.
  28.        <FW7>     8/15/96    ES        Added stuff to make isoch channel and port stuff asynchronous
  29.                                     and to support overrun handling to DV output.
  30.        <FW6>      8/2/96    ES        Updated for more isochronous changes.
  31.        <FW5>     7/31/96    ES        Changed to use new isochronous buffer architecture.
  32.        <FW4>      7/8/96    ES        Added stuff for dump and 3 frame snap shot loop playing
  33.                                     capabilities.
  34.        <FW3>     6/20/96    ES        Made this look more like a .i generated interface.
  35.        <FW2>     6/20/96    ES        Filled in contains and written by fields.
  36.        <FW1>     6/20/96    ES        first checked in
  37.  
  38. */
  39.  
  40. #ifndef __FWAVCDRIVER__
  41. #define __FWAVCDRIVER__
  42.  
  43. #ifndef __TYPES__
  44. #include <Types.h>
  45. #endif
  46. #ifndef __FIREWIRE__
  47. #include <FireWire.h>
  48. #endif
  49.  
  50. #ifdef __cplusplus
  51. extern "C" {
  52. #endif
  53.  
  54. #if PRAGMA_IMPORT_SUPPORTED
  55. #pragma import on
  56. #endif
  57.  
  58. #if PRAGMA_ALIGN_SUPPORTED
  59. #pragma options align=mac68k
  60. #endif
  61.  
  62. enum
  63. {
  64.     kDCLCommandPoolBlockSize    = 1024
  65. };
  66.  
  67. enum
  68. {
  69.     kNTSCFrameRateNumerator                = 2997,
  70.     kNTSCFrameRateDenominator            = 100
  71. };
  72.  
  73. enum
  74. {
  75.     kPlayFrameRateNumerator                = kNTSCFrameRateNumerator,
  76.     kPlayFrameRateDenominator            = kNTSCFrameRateDenominator,
  77.  
  78.     kPlayFramePeriodNumerator            = kPlayFrameRateDenominator,
  79.     kPlayFramePeriodDenominator            = kPlayFrameRateNumerator,
  80.  
  81.     kNumPlayBufferGroups                = 3,
  82.     kNumDataPacketsPerPlayBufferGroup    = 80,
  83.     kNumDataPacketsPerDVFrame            = 250,
  84.  
  85.     kPlaySYTDelay                        = 3,
  86.  
  87.     kDVPacketDataSize                    = 480,
  88.     kDVPacketCIPSize                    = 8
  89. };
  90.  
  91. enum
  92. {
  93.     kNumDVPacketsPerFrame        = 250,
  94.     kNumDVPaddingPacketsPerFrame    = 30,
  95.     kDVPacketSize                = 488,
  96.     kMinDVFrameSize                =
  97.         (kNumDVPacketsPerFrame + kNumDVPaddingPacketsPerFrame) * kDVPacketSize
  98. };
  99.  
  100. enum
  101. {
  102.     kNumPingPongs                = 2,
  103.     kNumPacketsPerPingPong        = 10,
  104.     kNumDCLsPerPingPongPacket    = 1,
  105.     kRecordNumDCLs                =
  106.         kNumPingPongs * kNumPacketsPerPingPong * kNumDCLsPerPingPongPacket,
  107.     kMaxDCLSize                    = 32,
  108.     kRecordDCLProgramSize        = kMaxDCLSize * kRecordNumDCLs,
  109.     kReceiveDVPacketSize        = 492,
  110.     kPingPongBufferSize            =
  111.         kNumPingPongs * kNumPacketsPerPingPong * kReceiveDVPacketSize
  112. };
  113.  
  114. typedef struct FWAVCDVPingPongDataStruct
  115.                                 FWAVCDVPingPongData,
  116.                                 *FWAVCDVPingPongDataPtr;
  117.  
  118. typedef struct FWAVCPlayBufferGroupDataStruct
  119.                                 FWAVCPlayBufferGroupData,
  120.                                 *FWAVCPlayBufferGroupDataPtr;
  121.  
  122. typedef struct DCLCommandBlockStruct
  123.                                 DCLCommandBlock,
  124.                                 *DCLCommandBlockPtr;
  125.  
  126. typedef struct DCLCommandPoolStruct
  127.                                 DCLCommandPool,
  128.                                 *DCLCommandPoolPtr;
  129.  
  130. struct FWAVCDriverDataStruct
  131. {
  132.     FWReferenceID                localFWReferenceID;        // Reference to local node.
  133.     FWDriverID                    fwDriverID;                // Our driver ID.
  134.     CSRROMEntryID                csrUnitID;                // Out unit directory ID.
  135.  
  136.     Boolean                        channelInitialized;        // True if channel has been initialized.
  137.     IsochPortID                    isochPortID;            // Local isochronous port ID.
  138.     UInt32                        isochChannelNum;        // Above isochronous channel nubmer.
  139.  
  140.     IsochChannelID                playIsochChannelID;        // ID of isochronous channel allocated
  141.                                                         // for playing to camera.
  142.     DCLProgramID                playDCLProgramID;        // ID of DCL program for playing.
  143.     FWAVCPlayBufferGroupDataPtr    pFWAVCPlayBufferGroupDataList;    // List of buffer group data records.
  144.     Ptr                            transmitBuffers;        // Buffer to use for transmit packet data.
  145.     DCLCommandPoolPtr            pPlayDCLCommandPool;    // Pool of DCL commands for playing.
  146.     DCLCommandPtr                playDCLList;            // DCLs used for playing.
  147.     DCLLabelPtr                    pUnderrunDCLLabel;        // Pointer to underrun label.
  148.     UInt32                        totalPlayPackets;        // Total number of packets for playing.
  149.     UInt32                        activePlayPackets;        // Total number of active packets for playing.
  150.     UInt32                        nominalFrameCycleTime;    // Nominal cycle time between frames.
  151.     UInt32                        sytNumerator;            // Numerator of fractional syt.
  152.     UInt32                        nextSYT;                // Next SYT to use on frame boundary.
  153.     UInt32                        nextDBC;                // Next DBC to use for first packet of next buffer group.
  154.     UInt32                        nextDataPacketNum;        // Data packet number for first data packet of next buffer group.
  155.     Boolean                        playSnapShotChannelInitialized;    // True if above channel has been initialized.
  156.  
  157.     IsochChannelID                recordIsochChannelID;    // ID of isochronous channel allocated
  158.                                                         // for recording from camera.
  159.     DCLProgramID                recordDCLProgramID;        // ID of DCL program for recording.
  160.     DCLCommandPtr                recordDCLList;            // DCLs used for recording.
  161.     DCLCommandPtr                *recordUpdateDCLList;    // DCL update list used for recording.
  162.     Ptr                            imageBuffer;            // Buffer to hold image in.
  163.     AVTDumpParamsPtr            pAVTDumpParams;            // Pointer to current dump request.
  164.  
  165.     FWCommandObjectID            isochChannelCommandObjectID,    // Command object for sending isoch channel commands.
  166.                                 stopIsochChannelCommandObjectID,    // Command object for asynchronously stopping an isoch channel.
  167.                                 startIsochChannelCommandObjectID;    // Command object for asynchronously starting an isoch channel.
  168.  
  169.     FWCommandObjectID            isochPortCommandObjectID,    // Command object for sending isoch port commands.
  170.                                 stopIsochPortCommandObjectID,    // Command object for asynchronously stopping an isoch port.
  171.                                 startIsochPortCommandObjectID;    // Command object for asynchronously starting an isoch port.
  172.  
  173.     FWCommandObjectID            fcpCommandObjectID;        // FireWire command object for sending FCP commands.
  174.     FWCommandObjectID            asyncFCPCommandObjectID;    // FireWire command object for sending FCP commands asynchronously.
  175.  
  176.     UInt32                        fcpCommandFrame[10];    // Pre-allocate FCP command frame.
  177. };
  178. typedef struct FWAVCDriverDataStruct
  179.                                 FWAVCDriverData,
  180.                                 *FWAVCDriverDataPtr;
  181.  
  182. struct FWAVCDVPingPongDataStruct
  183. {
  184.     FWAVCDriverDataPtr            pFWAVCDriverData;
  185.     DCLCommandPtr                pFirstDCLCommand;
  186. };
  187.  
  188. struct FWAVCPlayBufferGroupDataStruct
  189. {
  190.     FWAVCPlayBufferGroupDataPtr    pPrevFWAVCPlayBufferGroupData,    // Links to previous and next buffer group data records.
  191.                                 pNextFWAVCPlayBufferGroupData;
  192.  
  193.     FWAVCDriverDataPtr            pFWAVCDriverData;        // AVC driver data.
  194.  
  195.     DCLJumpPtr                    pEndOfBufferGroupDCLJump;    // Pointer to jump command to end of buffer group.
  196.     DCLLabelPtr                    pEndOfBufferGroupDCLLabel;    // Pointer to label command at end of buffer group.
  197.     DCLJumpPtr                    pBufferGroupSkipEmptyPacketDCLJump;    // Pointer to jump command to use to skip an empty packet.
  198.     DCLLabelPtr                    pBufferGroupSkipEmptyPacketDCLLabel;    // Label to jump to to skip an empty packet.
  199.     DCLLabelPtr                    pBufferGroupDontSkipEmptyPacketDCLLabel;    // Label to jump to to not skip an empty packet.
  200.     DCLCallProcPtr                pBufferGroupDCLCallProc;    // Pointer to buffer group's call proc command.
  201.     DCLTimeStampPtr                pBufferGroupDCLTimeStamp;    // Pointer to buffer group's time stamp command.
  202.     DCLCommandPtr                pFirstBufferGroupDCLCommand;    // Pointer to first DCL command in buffer group.
  203.     DCLCommandPtr                pLastBufferGroupDCLCommand;        // Pointer to last DCL command in buffer group.
  204.  
  205.     DCLCommandPtr                timeStampUpdateDCLList;    // DCL update list with just the buffer group's time stamp DCL.
  206.     DCLCommandPtr                *bufferGroupUpdateDCLList;    // List of DCL commands that need updating for each run through buffer group.
  207.     UInt32                        updateListSize;            // Number of DCL commands in above list.
  208.  
  209.     UInt32                        numPackets;                // Number of packets in this buffer group.
  210.     Boolean                        needsUpdate;            // True if we need to explicitly update DCL commands.
  211.     Boolean                        skippingEmptyPacket;    // True if pBufferGroupSkipEmptyPacketDCLJump is set to skip an empty packet.
  212. };
  213.  
  214. struct DCLCommandBlockStruct
  215. {
  216.     DCLCommandBlockPtr            pNextDCLCommandBlock;    // Pointer to next DCL command block.
  217.     Ptr                            block;                    // Block of data for DCLs.
  218.     UInt32                        blockLevel;                // Current allocation level of this block.
  219. };
  220.  
  221. struct DCLCommandPoolStruct
  222. {
  223.     DCLCommandBlockPtr            pFirstDCLCommandBlock,    // Pointers to first and last DCL command blocks.
  224.                                 pLastDCLCommandBlock;
  225. };
  226.  
  227. #if PRAGMA_ALIGN_SUPPORTED
  228. #pragma options align=reset
  229. #endif
  230.  
  231. #if PRAGMA_IMPORT_SUPPORTED
  232. #pragma import off
  233. #endif
  234.  
  235. #ifdef __cplusplus
  236. }
  237. #endif
  238.  
  239. #endif /* __FWAVCDRIVER__ */
  240.